package com.common.base.tools.obj

import android.content.Context
import android.graphics.Color
import com.common.base.R
import com.common.base.manager.StackManager
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.impl.LoadingPopupView

/**
 * 三疯
 * *************************
 *
 * *************************
 */
object LoadingObj {

    private lateinit var loadingPopup: LoadingPopupView

    fun showLoad(context: Context? = StackManager.getActivityManager().currentActivity()) {
        loadingPopup = XPopup.Builder(context)
            .dismissOnBackPressed(false)
            .isDestroyOnDismiss(true)
            .isLightNavigationBar(true)
            .shadowBgColor(Color.parseColor("#00000001"))
            .hasBlurBg(false)
//            .asLoading("少时诵诗书", LoadingPopupView.Style.Spinner)
            .asLoading(null, R.layout.dialog_loading, LoadingPopupView.Style.Spinner)
            .show() as LoadingPopupView

    }

    fun hintLoad() {
        if (this::loadingPopup.isInitialized)
            loadingPopup.dismiss()
    }
}